using System;
using System.IO;
using FileTransfer.Lib;
using NUnit.Framework;
using System.Linq;
using FileTransfer.AT;

namespace FileTransfer.AT{
	[TestFixture]
	public class PictureFormatConversionCase{
		[Test]
		public void CanConvertGIFtoPNG(){
			string currentPath =  System.Reflection.Assembly.GetExecutingAssembly().Location;
			string dataFilePath = Path.Combine(currentPath, "..\\..\\DataFiles");
			Console.WriteLine(dataFilePath);
			DirectoryInfo dataFileInfo = new DirectoryInfo(dataFilePath).Parent.Parent.GetDirectories("DataFiles")[0];
			Assert.IsNotNull(dataFileInfo);
			Assert.That(dataFileInfo.Exists);

			FileInfo pngFile = dataFileInfo.GetChild("impact.png");
			if(pngFile.Exists){
				pngFile.Delete();
			}

			FileInfo gifFile = dataFileInfo.GetChild("impact.gif");
			Assert.That(gifFile.Exists);

			ImageConverter converter = new ImageConverter();
			converter.Convert(gifFile);

			Assert.That(pngFile.Exists,pngFile.FullName + " is missing.");


		}
	}
}
